﻿
@{
    Layout = null;
    ViewBag.MenuId = 1;
}
<style>
    .swiper-container {
        width: 100%;
        padding-top: 5px;
        padding-bottom: 5px;
    }

    .swiper-slide {
        background-position: center;
        background-size: cover;
        width: 80%;
        /*height: 118px;*/
        border-radius: 5px;
    }

        .swiper-slide img {
            width: 100%;
            border-radius: 5px;
        }

    .swiper-pagination-bullet {
        background: #fff;
        opacity: 1;
    }

    .swiper-pagination-bullet-active {
        background: #eb272a;
    }

    .flayout_l_towfl {
        width: 100%;
        overflow-x: scroll;
        margin-bottom: 5px;
    }

        .flayout_l_towfl ul {
            overflow: hidden;
            padding: 5px 0px 5px 0;
            margin-right: -5px;
        }

            .flayout_l_towfl ul li {
                width: calc(100% - 25px);
                background: #fff;
                margin-left: 10px;
                border-radius: 5px;
                box-shadow: 0 0px 10px #dcdcdc;
                position: relative;
                float: left;
                margin-bottom: 10px;
            }

                .flayout_l_towfl ul li .l_taghd {
                    position: absolute;
                    top: -5px;
                    background: url(/Content/images/f_75.png) no-repeat center;
                    background-size: 100px;
                    left: 0;
                    width: 100%;
                    text-align: center;
                    font-size: 12px;
                    color: #fff;
                    height: 28px;
                    line-height: 2;
                }
</style>
<div ng-controller="ActivityIndexController">
    <div class="f_mb60">

        <!-- Swiper -->
        <div>
            <div>
                <carousel interval="myInterval">
                    <slide ng-repeat="slide in slides" active="slide.active">
                        <img ng-src="{{slide.image}}" ng-click="go(slide.url)" style="margin: auto;" alt="" />
                    </slide>
                </carousel>
            </div>
        </div>

        <!--展示用户抽奖信息-->
        @*<div class="w_honour_info f_honour_info"><img src="images/w_34.png" class="w_honour_head" />188****8888抽中五个积分</div>*@
        <!-- Swiper JS -->
      
        <!-- 一分钱活动 -->
        <div class="flayout_l_towfl">
            <ul>
                <li ng-repeat="model in acivitylist">
                    <div class="l_taghd">一分钱活动</div>
                    <div class="l_towfl_proBox">
                        <div class="l_towfl_img">
                            <img src="{{ImgHostUrl+model.CoverImg}}" alt="">
                        </div>
                        <div class="l_towfl_proInfo">
                            <p class="l_towfl_proName">{{model.ActivityName}}</p>
                            @*<p class="l_towfl_protags"><span>礼盒6袋</span><span>包邮</span></p>*@
                            <div class="l_towfl_proPrice">
                                <span class="span1">¥{{model.ActivityPrice}}</span>
                            </div>
                            <div class="l_towfl_proBtns">
                                <span class="left"><img src="/Content/images/f_73.png"><label>{{model.PeopleNum}}人团</label></span>
                                <a href="javascript:void(0)" ng-click="openactivity(model.Id)" class="right">立即开团</a>

                            </div>
                            <div class="clear"></div>
                        </div>
                    </div>
                </li>
            </ul>
        </div>
        <!--end 一分钱活动 -->
        <div class="flayout_l_threel" ng-show="isshow==0">
            <div class="ac_emptyBox">
                <img src="/Content/images/ac_empty.jpg" alt="活动为空">
                <div class="go_other"><a href="javascript:void(0)" ng-click="goindex()">去看看其他活动吧！！！</a></div>
            </div>
        </div>
        <!-- 底部 -->
        @Html.Partial("_actfoot")
        <!--end 底部 -->
    </div>
</div>

<script>


    App.controller('ActivityIndexController', [
           '$scope', '$http', '$rootScope', '$stateParams', '$state', '$filter', '$timeout',
       function ($scope, $http, $rootScope, $stateParams, $state, $filter, $timeout) {

           $scope.dt = {};
           $scope.acivitylist = [];
           $scope.isshow =1;

           $http.post("/Activity/GetPointCarouselList", { type: 6}).then(function (response) {
               if (response.data.isSuccess) {

                   $scope.CarouselList = response.data.data;
               }
               // 设置轮播图图片间隔
               $scope.myInterval = 5000;
               // 轮播图数据初始化
               var slides = $scope.slides = [];
               // 添加轮播图源
               if ($scope.CarouselList.length > 0) {
                   angular.forEach($scope.CarouselList, function (img) {
                       slides.push({ image: $rootScope.ImgHostUrl + img.ImgUrl, url: img.LinkUrl });
                   });
               }
               

             

           });

           $scope.goindex = function (aid, id) {
               $state.go('shop.index');
           }

           $http.post("/Activity/GetActivityListAll", {}).then(function (response) {
               debugger
               if (response.data.Results && response.data.Results != "") {
                   $scope.acivitylist = response.data.Results;
                   if ($scope.acivitylist.length == 0) {
                       $scope.isshow = 0;
                   }
               } else {
                   $scope.isshow = 0;
               }
           });

         
           $scope.openactivity = function (id) {
               $state.go('activity.activityinfo', { "Id": id });
           }

           $scope.go = function (url) {
               location.href = url;
           }
           var tt = function () {
               $rootScope.WxShare($rootScope.pageTitle(), '优品三悦', location.href, $rootScope.LogoUrl);
           }

           setTimeout(tt, 1000)
       }]);



</script>
